/*!
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

// stylelint-disable selector-max-type, selector-max-universal, no-descending-specificity, declaration-property-unit-whitelist

/*
 * Global
 */

// https://www.paulirish.com/2012/box-sizing-border-box-ftw/
// apply a natural box layout model to all elements, but allowing components to change
html {
  box-sizing: border-box;
}
*, *:before, *:after { // stylelint-disable-line
  box-sizing: inherit;
}

button,
input,
textarea,
table,
td,
th {
  font-family: inherit;
  font-size: inherit;
}

/*
 * Body
 */

.report-body {
  padding-bottom: 100px; // add space for .report-toolbar
  font-family: "Roboto Mono", Consolas, monospace;
  font-size: smaller;
}

/*
 * Headings
 */

.report-metadata__heading,
.report-collection__heading,
.report-html-file__heading,
.report-user-agent__heading {
  padding: 8px 10px;
  cursor: pointer;
}

.report-metadata__heading:hover,
.report-collection__heading:hover,
.report-html-file__heading:hover,
.report-user-agent__heading:hover {
  background-color: #ddd;
}

.report-metadata__heading-content,
.report-collection__heading-content,
.report-html-file__heading-content,
.report-user-agent__heading-content {
  display: inline-block;
  width: calc(100% - 7em);
  vertical-align: top;
}

.report-metadata__heading,
.report-collection__heading {
  margin: 20px 0;
  font-size: x-large;
}

.report-collection__checkbox--hidden,
.report-html-file__checkbox--hidden,
.report-user-agent__checkbox--hidden {
  pointer-events: none;
  visibility: hidden;
}

/*
 * Metadata
 */

.report-metadata__content {
  padding: 0 24px;
}

.report-metadata__table {
  border: 1px solid #eee;
  border-collapse: collapse;
}

.report-metadata__row--top-divider {
  border-top: 1px solid #eee;
}

.report-metadata__cell {
  padding: 2px 10px 2px 4px;
  font-weight: normal;
  text-align: left;
  vertical-align: top;
}

.report-metadata__cell--key {
  width: 10em;
  font-style: italic;
}

.report-metadata__commit-offset {
  color: #777;
  font-size: smaller;
}

/*
 * Collection
 * TODO(acdvorak): Find a better name
 */

.report-collection__heading {
  margin: 20px 0;
}

.report-collection__content {
  padding: 0 24px;
}

/*
 * Test page
 */

.report-html-file {
  margin-bottom: 20px;
  border: 1px solid #aaa;
  border-radius: 3px;
  background-color: #eee;
}

.report-html-file__heading {
  font-size: larger;
}

.report-html-file__content {
  padding: 0 24px;
}

/*
 * User agent
 */

.report-user-agent__icon {
  vertical-align: middle;
}

.report-user-agent__content {
  display: flex;
  padding: 10px 58px;
}

.report-user-agent__image-cell {
  // TODO(acdvorak): Find a better way to ensure that missing golden/snapshot/diff images don't collapse column
  // widths/heights.
  width: 400px;
}

.report-user-agent__image-cell + .report-user-agent__image-cell {
  margin-left: 24px;
}

.report-user-agent__image-heading {
  min-height: 3.5em;
}

.report-user-agent__image-type {
  border-bottom: 1px dotted #000;
}

.report-user-agent__image-dimensions {
  margin-top: 8px;
  color: #777;
  font-size: smaller;
}

.report-user-agent__image-link {
  display: block;
}

.report-user-agent__image {
  max-width: 100%;
  border-bottom: 1px solid;
  background-color: white;
  vertical-align: top;
}

.report-congrats {
  color: green;
  font-size: 3rem;
}

/*
 * Toolbar
 */

.report-toolbar {
  display: flex;
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: #ffff8e;
  box-shadow: 0 0 10px rgba(0, 0, 0, .3);

  @media (max-width: 1340px) {
    padding: 8px;
  }

  @media (min-width: 1341px) {
    padding: 24px;
  }
}

.report-toolbar__column {
  display: flex;
  flex-grow: 1;
  flex-wrap: wrap;
  align-items: baseline;
}

.report-toolbar__column + .report-toolbar__column {
  @media (max-width: 1340px) {
    margin-left: 8px;
  }

  @media (min-width: 1341px) {
    margin-left: 64px;
  }
}

.report-toolbar__column:last-child {
  justify-content: flex-end;
  text-align: right;
}

.report-toolbar__column:nth-child(2) {
  @media (max-width: 1340px) {
    justify-content: center;
    text-align: center;
  }
}

.report-toolbar__column--hidden {
  visibility: hidden;
}

.report-toolbar__column-label {
  @media (max-width: 1340px) {
    order: -1;
    width: 100%;
  }

  @media (min-width: 1341px) {
    margin-right: 12px;
    margin-left: 12px;
  }
}

.report-toolbar__column-label,
.report-toolbar__column-content {
  margin-top: 2px;
  margin-bottom: 2px;
}

.report-toolbar__button--approve,
.report-toolbar__button--retry {
  font-weight: bold;
}

.report-toolbar__button--approve {
  color: green;
}

.report-toolbar__button--approve:disabled {
  color: rgba(green, .5);
}

.report-toolbar__button--retry {
  color: red;
}

.report-toolbar__button--retry:disabled {
  color: rgba(red, .5);
}

/*
 * Review status bubble
 */

.report-review-status {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid #aaa;
  border-radius: 3px;
  background: #ccc;
  color: #000;
  font-size: .5em;
  text-align: center;
  vertical-align: middle;
}

.report-review-status--hidden {
  display: none;
}

.report-review-status[data-review-status="approve"] {
  border-color: green;
  background-color: #cfefc5;
  color: green;
}

.report-review-status[data-review-status="retry"] {
  border-color: red;
  background-color: #ffc6c3;
  color: red;
}

.report-review-status[data-review-status="mixed"] {
  border-color: purple;
  background-color: #ebb7fb;
  color: purple;
}

/*
 * CLI command modal window
 */

.report-cli-modal {
  display: flex;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, .25);
}

.report-cli-modal[data-state="closed"] {
  display: none;
}

.report-cli-modal__window {
  display: flex;
  flex-direction: column;
  width: 600px;
  height: 400px;
  border-radius: 2px;
  background-color: white;
  box-shadow: 0 0 30px rgba(0, 0, 0, .5);
}

.report-cli-modal__title {
  padding: 10px;
  font-size: large;
}

.report-cli-modal__content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 0 10px;
}

.report-cli-modal__command {
  flex-grow: 1;
  width: 100%;
  height: 100%;
  padding: 10px;
}

.report-cli-modal__footer {
  padding: 10px;
  text-align: right;
}

.report-cli-modal__button--copy {
  font-weight: bold;
}
